package com.lazy.study.demo.controller;

import com.github.pagehelper.PageHelper;
import com.lazy.study.demo.bean.Demo;
import com.lazy.study.demo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by lazy on 17-5-22.
 */
@RestController
public class DemoController {
    @Autowired
    private DemoService demoService;

    @RequestMapping("/hello")
    public String hello(String name,int state){
        return"name "+name+"---"+state;
    }

    @RequestMapping("/likeName")
    public List<Demo> likeName(String name){
        PageHelper.startPage(1,1);
        return demoService.likeName(name);
    }
}
